package com.micro.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * 用户
 * @author Administrator
 *
 */
@Table(
        name="login_token",
        indexes = {
                @Index(columnList = "id")
        }
)
@Entity
@Data
public class LoginToken {
    @Id
    @GenericGenerator(name = "uuid",strategy = "uuid")
    @GeneratedValue(generator = "uuid")
    @Column(name="id",columnDefinition="VARCHAR(50)")
    private String id;

    @Column(name="username",columnDefinition="VARCHAR(30)")
    private String username;

    @Column(name="token",columnDefinition="VARCHAR(35)")
    private String token;

    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接受
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")//返回
    @Column(name="createtime",columnDefinition="date")
    private Date createtime;

    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")//接受
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss")//返回
    @Column(name="expiretime",columnDefinition="date")
    private Date expiretime;

}
